package org.streets.eis.component.model;

import java.io.Serializable;

/**
 * url格式：[frameName:]uri
 * 		frameName : 当前页面中的frame的名字,
 * 			（使用这个时，请注意在frame控件上有对应的frame名字，若找不到改名字的frame，url会在当前窗口打开）
 * 		uri：mount好的路径或者Page类的全限定类名
 * 
 * 如：
 * 		/examples/tree
 * 		client:/examples/comboBox
 * 		com.sophia.hr.modules.examples.pages.DateTimePage
 * 		client:com.sophia.hr.modules.examples.pages.DateTimePage
 * 
 * icon格式：
 * 		web目录下：以"/"打头，如"/image/aa.gif" 指的是web目录下的image目录中的aa.gif
 * 
 * 		web/WEB-INF/classes目录下(即src目录下编译过去的)：类全限定名+相对路径
 * 			如：
 * 				com.sophia.hr.HomePage/aa.gif 即表示web/WEB-INF/classes/com/sophia/hr/HomePage目录下的aa.gif
 * 				com.sophia.hr.HomePage/res/aa.gif 即表示web/WEB-INF/classes/com/sophia/hr/HomePage/res目录下的aa.gif 
 *
 */
public class MenuItem implements Serializable {

	private static final long serialVersionUID = 1L;

	private String id;
	
	private String code;
	
	private String displayText;
	
	private String url;
	
	private boolean disabled;
	
	private String icon;
	
	private String hint;
	
	public MenuItem(){		
	}
	
	public MenuItem(String id,String code,String displayText){
		this(id,code,displayText,"",false);
	}
	
	public MenuItem(String id,String code,String displayText,String hint){
		this(id,code,displayText,hint,false);
	}
	
	public MenuItem(String id,String code,String displayText, String hint, boolean disabled){
		this.id = id;
		this.code = code;
		this.displayText = displayText;
		this.disabled = disabled;
		this.hint = hint;
	}	
	
	public MenuItem(String id,String code,String displayText, String url,String hint){
		this(id,code,displayText,url,hint,false);
	}
	
	public MenuItem(String id,String code,String displayText, String url,String hint,boolean disabled){
		this.id = id;
		this.code = code;
		this.displayText = displayText;
		this.url = url;
		this.disabled = disabled;
		this.hint = hint;
	}
	
	public String getId() {
		return id;
	}

	public MenuItem setId(String id) {
		this.id = id;
		return this;
	}
	
	public String getCode() {
		return code;
	}

	public MenuItem setCode(String code) {
		this.code = code;
		return this;
	}

	public String getDisplayText() {
		return displayText;
	}

	public MenuItem setDisplayText(String displayText) {
		this.displayText = displayText;
		return this;
	}

	public String getUrl() {
		return url;
	}

	public MenuItem setUrl(String url) {
		this.url = url;
		return this;
	}

	public boolean isDisabled() {
		return disabled;
	}

	public MenuItem setDisabled(boolean disabled) {
		this.disabled = disabled;
		return this;
	}

	public String getIcon() {
		return icon;
	}

	public MenuItem setIcon(String icon) {
		this.icon = icon;
		return this;
	}	
	
	public String getHint() {
		return hint;
	}

	public MenuItem setHint(String hint) {
		this.hint = hint;
		return this;
	}		
	
	@Override
	public String toString(){
		return displayText;
	}
}
